const express = require('express');
const router = express.Router();
const questionCommentController = require('../controllers/questionCommentController');
const userController = require('../controllers/userController');

router.use(userController.verifyToken)

// 添加评论
router.post('/add', questionCommentController.addQuestionComment);

// 获取题目的评论列表
router.get('/list', questionCommentController.getQuestionComments);

// 点赞/取消点赞评论
router.post('/likes', questionCommentController.likeComment);

// 更新评论
router.put('/edit', questionCommentController.updateComment);

// 删除评论
router.delete('/delete', questionCommentController.deleteComment);

// 获取用户的所有评论
router.get('/user', questionCommentController.getUserComments);

// 获取题目的评分统计
router.get('/ratings/:questionId', questionCommentController.getQuestionRatings);

module.exports = router; 